import HTTP from '../libs/http'

class AxiosModel {
  constructor () {
    this.buildingQueryController = new BuildingQueryController()
  }
}

class BuildingQueryController extends HTTP {
  /**
   * @description: 获取楼栋数据
   * @param {number} pageNo
   * @param {number} pageSize
   */
  postQueryBuilding ({ pageNo, pageSize }) {
    return this.request({
      method: 'POST',
      url: '/lsms/api/getDatas/lsms_building',
      data: {
        pageNo: pageNo,
        pageSize: pageSize
      }
    })
  }

  getBuildingStatistics () {
    return this.request({
      method: 'POST',
      url: '/lsms/api/getDatas/lsms_dashboard_building_statistics',
      data: {
        tjType: 0,
        groupType: '3D'
      }
    })
  }

  getFloorBriefInfo ({ buildingId }) {
    return this.request({
      method: 'POST',
      url: '/lsms/api/getDatas/lsms_dashboard_building_statistics',
      data: {
        tjType: 1,
        buildingId: buildingId
      }
    })
  }

  getDictItems () {
    return this.request({
      method: 'GET',
      url: '/lsms/api/dict/getDictItems?dictCode=LSMS_LAB_CAMPUS&state=1&language=zh-CN'
    })
  }

  getCollegeList () {
    return this.request({
      method: 'GET',
      url: '/lsms/api/dashBoard/getCollegeList'
    })
  }

  getParentSearch () {
    return this.request({
      method: 'GET',
      url: '/lsms/api/dict/getDictItems?dictCode=LSMS_SYS_OBJECT_TYPE&state=1&language=zh-CN'
    })
  }
  getChildSearch () {
    return this.request({
      method: 'GET',
      url: '/lsms/api/dashBoard/allOptionItems'
    })
  }
  getBuildingInfo ({ orgCode, option, selectType, content }) {
    return this.request({
      method: 'POST',
      url: '/lsms/api/dashBoard/getBuildingList',
      data: {
        orgCode,
        option,
        selectType,
        content
      }
    })
  }
  getLabRoomInfo () {
    return this.request({
      method: 'GET',
      url: '/lsms/api/dashBoard/getLabRoomInfo'
    })
  }
  getDashboardGas () {
    return this.request({
      method: 'POST',
      url: '/lsms/api/getDatas/lsms_dashboard_gas',
      data: {
        tjType: 0,
        groupType: '3D'
      }
    })
  }
  getChemical () {
    return this.request({
      method: 'POST',
      url: '/lsms/api/getDatas/lsms_dashboard_chemical',
      data: {
        tjType: 0,
        groupType: '3D'
      }
    })
  }
  getPurchase () {
    return this.request({
      method: 'POST',
      url: '/lsms/api/getDatas/lsms_dashboard_chemical_purchase',
      data: {
        tjType: 0,
        groupType: '3D'
      }
    })
  }
  getDashboardCheck () {
    return this.request({
      method: 'POST',
      url: '/lsms/api/getDatas/lsms_dashboard_check',
      data: {
        tjType: 0,
        groupType: '3D'
      }
    })
  }

  getFloorDetail ({ buildingId, levelAt, labRoomId, gasLeakDate }) {
    return this.request({
      method: 'POST',
      url: '/lsms/api/getDatas/lsms_dashboard_building_floor',
      data: {
        buildingId,
        levelAt,
        labRoomId,
        gasLeakDate
      }
    })
  }
}

const axiosModel = new AxiosModel()

export default axiosModel
